#ifndef __UTILITY_H__
#define __UTILITY_H__


#include "../Global.h"

class Utility : public MemoryManagerDelegate
{
public:
	Utility( )
	{
		srand(time(NULL));
	}

	virtual ~Utility( )
	{

	}


	static Utility*			sharedUtility		( );

	static inline
		const char*		getSpriteWithColorType( COLOR_TYPE type )
	{
		const char* fileName = "";
		CCAssert( type != kColorTypeNone , "Cannot init with color type none");

		switch (type)
		{
		case kColorTypeRed :
				{
					fileName = s_SpriteFrameName_RedCircle;
				}break;
		case kColorTypeYellow :
				{
					fileName = s_SpriteFrameName_YellowCircle;
				}break;
		case kColorTypeBlue :
				{
					fileName = s_SpriteFrameName_BlueCircle;
				}break;
		case kColorTypePurple :
				{
					fileName = s_SpriteFrameName_PurpleCircle;
				}break;
		case kColorTypeGreen :
				{
					fileName = s_SpriteFrameName_GreenCircle;
				}break;
		}

		return fileName;
	}

	static inline
		bool			checkPointInCircle( CCPoint p , CCPoint origin , float radius )
	{
		float distance = ccpDistance( p , origin );
		
		return distance <= radius;
	}

	static inline
		bool		checkCircleVsCircle( CCPoint origin_1 , float radius_1 , CCPoint origin_2 , float radius_2 )
	{
		float distance = ccpDistance( origin_1 , origin_2 );

		return distance <= ( radius_1 + radius_2 );
	}

	inline
		int			getRandomInt ( int min , int max )
	{
		return rand() % max + min;
	}
};

#endif